#-*- coding:utf-8 -*-  

class Base:
    _name='_base'
    _dept='_dept'
    __address='Beijing'
    
    def __enter__(self):
        print "__enter__"
        self.__db = "__db"
        self._db = "_db"
        return self
        
    def __exit__(self, type, value, traceback):
        print "__exit__"
        

class User(Base):
    _name='_user'
    __address='Shanghai'
    
    
    def login(self):
        print "__login__"
#        print self.__db
        print self._db
        print self._name
        
if __name__ == '__main__':        
#    with User() as u:
#        u.login()
#        print isinstance(u, object)
    u = User()
    print dir(u)
    print u._Base__address
    print u._name
    print u.__dict__
        